<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> 组件</title>
    <style>
        .laoshu{
            background-color: aqua;
        }
        .cat{
            background-color: red;
        }
    </style>
</head>
<body>
    <div id="app">
        <tom></tom>
        <jery></jery>
    </div>

    <script src="../Day1/js/vue.js"></script>

    <script>

        //局部注册
        var com1={
            data:function(){
                return{
                    num:10
                }
            },
            template :`<div class='laoshu'>jery={{num}}</div>`
        }

        var com2={
            data:function(){
                return{
                    num:8
                }
            },
            template :`<div class='cat'>tom={{num}}
                <jery></jery>
                </div>`,
            components:{
                'jery':com1
            }
        }

        var vm=new Vue({
            el:'#app',
            data:{
               msg:'vue'
            },
            components:{
                'tom':com2,
                'jery':com1,
            }
        });
    </script>
</body>
</html>